﻿using System;

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Routing;

using Bootstrap5.Abstractions;

namespace Bootstrap5;

/// <summary>
/// Represents a item in <see cref="DropDownMenu"/> component as a <c>&lt;a></c> element with same attributes.
/// </summary>
[CssClass("dropdown-item")]
public class DropDownLinkItem: DropDownItem<DropDownLinkItem>
{
    [Parameter] public NavLinkMatch Match { get; set; }
    [Parameter] [CssClass("disabled")] public bool Disabled { get; set; }
    [Parameter] [CssClass("active")] public bool Active { get; set; }
    protected override void BuildChildRenderTree(RenderTreeBuilder builder)
    {
        builder.OpenComponent<NavLink>(0);
        builder.AddAttribute(1, nameof(NavLink.ChildContent), ChildContent);
        BuildCommonAttributes(builder);
        builder.CloseComponent();
    }
}
